<?php

/**
 * Categoy Details
 * 
 * @project : Loobica
 * @author  : Dino
 * @date    : 2 Mar 2014
 * 
 */
if (!defined('BASEPATH'))
  exit('No direct script access allowed');

class Category extends LB_Controller {

  public function index($category_id = 0, $category_name = null) {

    if (!empty($category_id)) {

      // Getting category data
      $category = $this->category_model->get_category($category_id);

      if (!empty($category)) {

        // Execute the filter library
        $this->load->library('loobica/filter_system');
        $filter = $this->filter_system->category($category_id)->init();

        // Prepare and load view
        $view_data = array();
        $view_data['title'] = 'Category';
        $view_data['menu_active'] = 'category_' . $category_id;
        $view_data['category'] = $category;
        $view_data['filter'] = $filter;
        $this->load_view('category/category', $view_data);
        return;
      }
    }

    $this->redirect('home');
  }

}

?>